package tue.cse.advanceddatabases.project.xml.track;

import java.util.List;
import java.util.Vector;
import java.util.logging.Logger;

import org.dom4j.Element;

public class TrackParser {
	private static Logger logger = Logger.getLogger(TrackParser.class.getName());
	
	public static List<Track> parse(List<Element> tracksElement) {
		return parse(tracksElement.get(0));
	}
	
	public static List<Track> parse(Element tracksElement) {
		List<Track> tracks = new Vector<Track>();
		
		List<Element> trackElements = tracksElement.elements();
		
		logger.info("Number of Tracks are:" + trackElements.size());
		for (int i=0; i< trackElements.size(); i++){
			Element element = trackElements.get(i);
			tracks.add(new Track(element));
		}
		return tracks;
	}
}
